export class SerialError extends Error {
  readonly code: number;

  constructor(
    message: string,
    code: number = 3000,
    options?: { cause?: unknown }
  ) {
    super(message, options);
    this.name = 'SerialError';
    this.code = code;
  }

  toJSON() {
    return {
      name: this.name,
      message: this.message,
      code: this.code,
      stack: this.stack,
    };
  }
}
